package com.cgw.dmplt.rent.dao.ibatis;

import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.cgw.dmplt.rent.domain.UserRoom;
import com.cgw.dmplt.rent.dao.UserRoomDao;

/**
 *
 */
public class UserRoomDaoImpl extends SqlMapClientDaoSupport implements UserRoomDao
{
    
    /**
     * insert.
     * @param userRoom userRoom
     * @return id
     */
    public String insertUserRoom(UserRoom userRoom){
    	getSqlMapClientTemplate().insert("UserRoom_insertUserRoom", userRoom);
    	return null;
    }

    /**
     * delete.
     * @param userRoom userRoom
     */
    public void deleteUserRoom(UserRoom userRoom)throws DataAccessException {
        getSqlMapClientTemplate().update("UserRoom_deleteUserRoom", userRoom);
    }
    
    /**
     * update.
     * @param userRoom userRoom
     */
    public void updateUserRoom(UserRoom userRoom){
    	getSqlMapClientTemplate().update("UserRoom_updateUserRoom", userRoom);
    }
    
    /**
     * find.
     * @param id id
     * @return userRoom
     */
    public UserRoom findUserRoom(Integer pk){
        UserRoom userRoom = (UserRoom) getSqlMapClientTemplate().queryForObject("UserRoom_findUserRoom", pk);
        return userRoom;
    }
    
    /**
     * list.
     * @param userRoom userRoom
     * @return userRoom list
     */
    public List listUserRoom(UserRoom userRoom){
        List list = getSqlMapClientTemplate().queryForList("UserRoom_listUserRoom", userRoom);
        return list;
    }  
    
    /**
     * listCount.
     * @param userRoom userRoom
     * @return list count

     */
    public Integer listUserRoomCount(UserRoom userRoom){
        Integer count = (Integer)getSqlMapClientTemplate().queryForObject("UserRoom_listUserRoomCount", userRoom);
        return count;
    }  
}
